<%--
  Created by IntelliJ IDEA.
  User: tangms
  Date: 2022/4/10
  Time: 10:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<style>
    *{
        margin: 0px;
        padding: 0px;
        box-sizing: border-box;
    }
    .bag{
        width: 500px;
        height:110px;
        border: 8px solid #EEEEEE;
        margin: auto;
        padding: 15px;

    }
    .choice{
        border: 1px solid lightskyblue;
        margin: auto;
    }
    .button{
        border: 1px solid dodgerblue;
        background-color: dodgerblue;
        align-content: center;
        /*// margin-top: 200px;*/
    }
    #firstPage{
        float: left;
        margin: auto;
    }
    #view{
        float: right;
        margin: auto;
    }
    #game{
        margin-left: 15px;
        margin-right: 20px;
    }
    #food{
        margin-left: 15px;
        margin-right: 20px;
    }
    #cartoon{
        margin-left: 15px;
        margin-right: 10px;
    }
    .end{
        float: right;
        margin-top: 10px;
    }
    .title_left{
        margin-left: 420px;
    }
    .type{
        margin-left: 420px;
    }
    .content_left{
        border:1px solid black;
        width: 440px;
        margin-left: 420px;
        height: 100px;
        margin-bottom: 20px;
    }
    .delete{
        margin-left: 790px;
    }
    .back{
        margin-left: 800px;
    }
    .page{
        margin-left: 420px;
    }
    .active{
        border:1px solid lightskyblue;
        background-color:lightskyblue;
        width:12px;
        height:10px;
    }
    .nonactive{
        border:1px solid black;
        width:12px;
        height:10px;
    }
</style>
<%--<script>--%>
<%--    function deleteNote(id){--%>
<%--        if(confirm("您确定删除吗？")){--%>
<%--            location.href="${pageContext.request.contextPath}/delForSysServlet?id="+id;--%>
<%--        }--%>
<%--    }--%>
<%--</script>--%>
<body>

<%
    request.getParameter("page");
    int i=0;
    request.setAttribute("order",i);
    String type=request.getParameter("type");
    request.setAttribute("type",type);
%>
<h2 align="center">${type}</h2>
<a href="${pageContext.request.contextPath}/pageServlet?action=allNotesPage"><h6 class="back">返回首页</h6></a>
<%--<h3 align="center">${page.list[0].type}</h3>--%>

<c:forEach items="${page.list}" var="note" varStatus="s">
    <c:if test="${note.style==1}">
        <form>
            <table>
                <tr>
                    <td>
                        <h5 class="title_left">${order=order+1}.${note.title}</h5>
                        <h5 class="type">${note.type}</h5>
                        <p class="content_left">${note.content}</p>
                    </td>
                </tr>
            </table>
        </form>
    </c:if>
</c:forEach>

<div class="page">
    <nav aria-label="page navigation">
        <ul class="pagination">
            <c:if test="${page.currentPage==1}">
    <span aria-label="Previous">
        <span aria-hidden="true">&laquo;</span>
    </span>
            </c:if>
            <c:if test="${page.currentPage!=1}">
                <a href="${pageContext.request.contextPath}/pageServlet?action=areaNotesPage&currentPage=${page.currentPage-1}&rows=5&type=${type}" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </c:if>
            <c:forEach begin="1" end="${page.totalPage}" var="i">

                <c:if test="${page.currentPage==i}">
                    <a href="${pageContext.request.contextPath}/pageServlet?action=areaNotesPage&currentPage=${i}&rows=5&type=${type}"  class="active">${i}</a>
                </c:if>
                <c:if test="${page.currentPage!=i}">
                    <a href="${pageContext.request.contextPath}/pageServlet?action=areaNotesPage&currentPage=${i}&rows=5&type=${type}" class="nonactive">${i}</a>
                </c:if>
            </c:forEach>
            <c:if test="${page.currentPage!=page.totalPage&&page.totalPage!=0}">
                <a href="${pageContext.request.contextPath}/pageServlet?action=areaNotesPage&currentPage=${page.currentPage+1}&rows=5&type=${type}" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </c:if>
            <c:if test="${page.currentPage==page.totalPage||page.totalPage==0}">
                <span aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </span>
            </c:if>
            <span style="font-size: 20px;margin-left: 5px;">
                共${page.total}条笔记，共${page.totalPage}页
            </span>
        </ul>
    </nav>
</div>
</body>
</html>
